package com.project.service.impl;

import java.util.List;
import java.util.Map;

import com.project.service.ChargeManage;
import com.project.DAO.*;
import com.project.entity.PersonInfo;
import com.project.entity.PersonInfoExample;
import com.project.entity.ProjectFee;
import com.project.entity.ProjectFeeExample;
import com.project.entity.UnitInfo;
import com.project.entity.UnitInfoExample;
import com.project.mapper.*;
public class ChargeManageService implements ChargeManage {
	private	ProjectFeeMapper	projectFeeMapper;
	private PersonInfoMapper	personInfoMapper;
	private UnitInfoMapper		unitInfoMapper;
	
	public UnitInfoMapper getUnitInfoMapper() {
		return unitInfoMapper;
	}

	public void setUnitInfoMapper(UnitInfoMapper unitInfoMapper) {
		this.unitInfoMapper = unitInfoMapper;
	}

	public PersonInfoMapper getPersonInfoMapper() {
		return personInfoMapper;
	}

	public void setPersonInfoMapper(PersonInfoMapper personInfoMapper) {
		this.personInfoMapper = personInfoMapper;
	}

	public ProjectFeeMapper getProjectFeeMapper() {
		return projectFeeMapper;
	}

	public void setProjectFeeMapper(ProjectFeeMapper projectFeeMapper) {
		this.projectFeeMapper = projectFeeMapper;
	}
	
	public List<ProjectFee> getAllProjectFee(Map<String,String> map){
		return projectFeeMapper.getAllProjectFee(map);
	}

	public int insertProjectFee(ProjectFee projectFee) {
		// TODO Auto-generated method stub
		int  i;
		try{
			i = this.projectFeeMapper.insert(projectFee);
		}catch(Exception e){
			i = 0 ;
			e.printStackTrace();
		}
		return i;
	}

	
	/**
	 * 更新收费管理记录
	 */
	public int updateProjectFee(ProjectFee projectFee) {
		int i;
		try {
			i = this.projectFeeMapper.updateProjectFee(projectFee);
		}catch(Exception e)
		{
			e.printStackTrace();
			i = -1;
		}
		return i;
	}

	public int countProjectFee(Map<String,String> map){
		int i = this.projectFeeMapper.CountProjectFee(map);
		return i;
	}
	
	
	
	public int  getPersonCount(){
		PersonInfoExample example = new PersonInfoExample();
		return this.personInfoMapper.countByExample(example);
	}
	public List<PersonInfo> getAllPerson(Map<String, String> map) {
		// TODO Auto-generated method stub
		return this.personInfoMapper.getAllPerson(map);
	}

	public int getUnitCount(){
		UnitInfoExample example = new UnitInfoExample();
		return this.unitInfoMapper.countByExample(example);
	}
	public List<UnitInfo> getAllUnit(Map<String, String> map) {
		// TODO Auto-generated method stub
		return this.unitInfoMapper.getAllUnit(map);
	}
}
